/**
 * Desenvolvido pela Fábrica de Software do CESUPA.
 * Todos os direitos reservados.
 */
package br.cesupa.fabsoft.nomedoprojeto.system.application.beans;

import br.cesupa.fabsoft.nomedoprojeto.system.application.CommonWebOperations;
import br.cesupa.fabsoft.nomedoprojeto.system.application.facades.ApplicationFacade;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Breno Leite
 */
public class SessionBean {

    /**
     * Retrieves the current instance of this bean been managed by the Java
     * Server faces.
     *
     * @return the current instance of this bean
     */
    public static SessionBean getCurrentInstance() {
        return (SessionBean) ApplicationFacade.getManagedBeanFacade().
                getManagedBeanCurrentInstance("sessionBean");
    }

    /**
     * Checks if the current user is authenticated in the system.
     *
     * @return true if he/she is authenticated, false otherwise
     */
    public boolean isUserAuthenticated() {
        return false;
    }

    /**
     * @return a string based navigation stimulus for the controller
     * @see CommonWebOperations#logout()
     */
    public String logout() {
        ApplicationFacade.performWebOperation().logout();
        return "SYSTEM.goToLogin";
    }
}
